import 'package:flutter_basic/basic/basic_controller.dart';
import 'package:get/get.dart';

abstract class BasicPage<T extends BasicController> extends GetView<T> {

  late final String? _tag;
  String? get viewTag => _tag;

  @override
  T get controller => GetInstance().find<T>(tag: _tag);

  BasicPage.bind(T controller, {String? tag}) {
    _tag = tag ?? DateTime.now().millisecondsSinceEpoch.toString();
    print('BasePage.bind：${controller.runtimeType} tag:$_tag');
    controller.tag = _tag;
    Get.put(controller, tag: _tag);
  }
}